<?php 
set_time_limit(0);
ini_set("memory_limit", "12M");
if(!isset($_SESSION)) 
{ 
session_start(); 
} 
include '../connection/connection.php';

$inputfrom = $_REQUEST['inputfrom'];
	$input_hourfrom = $_REQUEST['input_hourfrom'];
	$input_munitefrom = $_REQUEST['input_munitefrom'];
	$input_secondfrom = $_REQUEST['input_secondfrom'];
	$inputto = $_REQUEST['inputto'];
	$input_hourto = $_REQUEST['input_hourto'];
	$input_muniteto = $_REQUEST['input_muniteto'];
	$input_secondto = $_REQUEST['input_secondto'];
	$s_monitor = $_REQUEST['re_monitor'];
	$s_camera = $_REQUEST['re_camera'];
	$m_fromdate = $inputfrom." ".$input_hourfrom.":".$input_munitefrom.":".$input_secondfrom;
	$m_todate = $inputto." ".$input_hourto.":".$input_muniteto.":".$input_secondto;


$selectallcamenra = mysql_query("select co.id,co.name,ca.isReg,count(*) as count1 from configcamera co, carnum ca where ca.car_datetime >='$m_fromdate' and ca.car_datetime <='$m_todate' and co.id=ca.id and ca.id =$s_camera GROUP BY co.id,ca.isReg",$connection);
				$index = 0;
				$count = 0;
				$isReg = 0;
				$isNoReg = 0;
				$total = 0;
    			while ($row = mysql_fetch_array($selectallcamenra)){
    				$count+=1;
					if($count==1){
						$obj1 = $row;
					}else if ($count==2) {
						$obj2 = $row;
					}
    			}
    			if ($count==1) {
    				if ($obj1[isReg] == 1) {
    					$isReg = $obj1[count1];
    					$total = $isReg;
    				}else{
    					$isNoReg = $obj1[count1];
    					$total = $isNoReg;
    				}
    			}
    			else if ($count==2){
					$isReg = $obj2[count1];
					$isNoReg = $obj1[count1];
					$total = $isReg + $isNoReg;
				}
				?>
				<div>
					<input type="hidden" id="isReg" value="<?=$isReg?>" />
					<input type="hidden" id="isNoReg" value="<?=$isNoReg?>" />
					<input type="hidden" id="total" value="<?=$total?>" />
				</div>
				<?php 

mysql_close($connection);

?>  